/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package eceptionDemo;

/**
 *
 * @author chen
 */
public class DemoExcep {
    public static void main(String[] args)
    {
       SomeClass s=new SomeClass();
      try{
       new DemoExcep().f(s);
      }catch(MyException e)
      {
          e.printStackTrace();
      }
    }
    void f(SomeClass s) throws MyException
    {  
        s.setAge(-1);
        s.checkAge();
        System.out.println(s);
    }
}
